package tech.xs.common.framework.config.mybatis;

import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;

import javax.annotation.Resource;

@Configuration
@Order(10100)
public class MyBatisPlusConfig {

    @Resource
    private MybatisPlusDeletePlug mybatisPlusDeletePlug;

    /**
     * 分页插件
     *
     * @return mybatis插件实例
     */
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor());
        interceptor.addInnerInterceptor(mybatisPlusDeletePlug);
        return interceptor;
    }

}
